package com.hmall.api.feign;

import java.util.Collection;
import java.util.List;

import com.hmall.api.config.DefaultFeignConfig;
import com.hmall.api.dto.ItemDTO;
import com.hmall.api.dto.OrderDetailDTO;
import com.hmall.api.feign.fallback.ItemRemoteFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: 龙玉虎 yuhu.long@hand-china.com
 * @CreateTime: 2024-12-05
 * @Description: 商品远程服务调用
 */

@FeignClient(value = "item-service", configuration = DefaultFeignConfig.class, fallbackFactory = ItemRemoteFallback.class)
public interface ItemRemote {

    @GetMapping("/items")
    List<ItemDTO> queryItemByIds(@RequestParam("ids") Collection<Long> ids);

    @PutMapping("/items/stock/deduct")
    void deductStock(@RequestBody List<OrderDetailDTO> items);
}
